struct Solution {}

fn main() {}

impl Solution {
    pub fn self_dividing_numbers(left: i32, right: i32) -> Vec<i32> {
        let mut ret_vec: Vec<i32> = Vec::new();
        for num in left..=right {
            if Self::check(num) {
                ret_vec.push(num);
            }
        }
        ret_vec
    }

    pub fn check(num: i32) -> bool {
        let num_arr = num.to_string()
            .as_bytes()
            .iter()
            .map(|&e| (e as char).to_digit(10).unwrap())
            .collect::<Vec<u32>>();
        for digit in 0..num_arr.len() {
            if (num_arr[digit] as i32) == 0 {
                return false;
            }
            if num % (num_arr[digit] as i32) != 0 {
                return false;
            }
        }
        true
    }
}